package com.flyduck.vueshop.user.feign;

import com.flyduck.vueshop.common.core.lang.Result;
import com.flyduck.vueshop.user.vo.RemoteUserRespVO;
import com.flyduck.vueshop.user.vo.RemoteUserSaveReqVO;
import com.flyduck.vueshop.user.vo.RemoteUserUpdateReqVO;
import com.flyduck.vueshop.user.fallback.RemoteUserFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * AppUserFeignClient
 * </p>
 *
 * @author flyduck
 * @since 2024-07-10
 */
@FeignClient(name = "vueshop-service-user",contextId = "remoteUserFeignClient",fallback = RemoteUserFallback.class)
public interface RemoteUserFeignClient {

    @GetMapping("/user/remote/user/getUserByUsername")
    Result<RemoteUserRespVO> getUserByUsername(@RequestParam("username") String username);

    @GetMapping("/user/remote/user/getUserById/{id}")
    Result<RemoteUserRespVO> getUserById(@PathVariable("id") Long id);

    @PostMapping("/user/remote/user/saveUser")
    Result<Void> saveUser(@RequestBody RemoteUserSaveReqVO remoteUserSaveReqVO);

    @PostMapping("/user/remote/user/updateUser")
    Result<Void> updateUser(@RequestBody RemoteUserUpdateReqVO remoteUserUpdateReqVO);
}
